﻿using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Web;
using System.Web.Mvc;

namespace Model
{

    [MetadataType(typeof(Product_Metadata))]
    [DisplayName("产品")]
    public partial class Product
    {
        public Product()
        {
            this.Id = Guid.NewGuid();
            this.UserId = new Guid(HttpContext.Current.User.Identity.Name);
            this.AddDate = DateTime.Now;
        }

        public class Product_Metadata
        {
            [ScaffoldColumn(false)]
            public Guid Id { get; set; }

            [ScaffoldColumn(false)]
            public Guid UserId { get; set; }

            [DisplayName("供应商")]
            [DropDownList("Supplier", "Id", "SupplierName")]
            public object SupplierId { get; set; }

            [DisplayName("产品名称")]
            [Required]
            public object ProductName { get; set; }

            [DisplayName("产品编码")]
            [DisplayFormat(ConvertEmptyStringToNull = false)]
            public object ProductCode { get; set; }

            [DisplayName("产品分类")]
            [DropDownList("ProductCatalog", "Id", "CatalogName")]
            public object CatalogId { get; set; }

            [DisplayName("添加日期")]
            public object AddDate { get; set; }

            [DisplayName("单位")]
            [DisplayFormat(ConvertEmptyStringToNull = false)]
            public object Unit { get; set; }

            [DisplayName("重量")]
            [DisplayFormat(ConvertEmptyStringToNull = false)]
            public object Weight { get; set; }

            [DisplayName("成本价")]
            [DisplayFormat(ConvertEmptyStringToNull = false)]
            public object CostPrice { get; set; }

            [DisplayName("零售价")]
            [DisplayFormat(ConvertEmptyStringToNull = false)]
            public object SalePrice { get; set; }

            [DisplayName("描述信息")]
            [DisplayFormat(ConvertEmptyStringToNull = false)]
            [DataType(DataType.MultilineText)]
            public object Description { get; set; }
        }
    }
}
